package senpec.qc.harmony.base.mybatisplus;

import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

public interface IBaseService<T extends IBaseEntity<T>> extends IService<T> {

    default Result<T> getById(Long id) {
        return Result.error();
    }

    default Result<T> getOneByCondition(String columnName, Object columnValue) {
        return Result.error();
    }

    default Result<List<T>> getListByCondition(String columnName, Object columnValue) {
        return Result.error();
    }

    default Result<T> getOneByConditions(T conditions) {
        return Result.error();
    }

    default Result<List<T>> getListByConditions(T conditions) {
        return Result.error();
    }

    default Result<T> insertOne(T entity) {
        return Result.error();
    }

    default Result<T> updateOne(T entity) {
        return Result.error();
    }

    default Result<?> physicalDeleteById(Long id) {
        return Result.error();
    }

    default Result<?> logicalDeleteById(Long id) {
        return Result.error();
    }

    default Result<?> activeById(Long id) {
        return Result.error();
    }

    default void setCreatorAndUpdater(T entity) {
    }

    default Result<List<T>> getTree() {
        return null;
    }

    default void setVersion(T entity) {
        entity.setVersion(entity.selectById().getVersion());
    }
}